cmake_minimum_required(VERSION 3.14)
project(testProtobufc)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CX_STANDARD 11)
set(BUILDING_TEST)

if (WIN32)
    add_definitions(-D_WIN32 -DWIN32 )
    set(CompilerFlags
            CMAKE_CXX_FLAGS
            CMAKE_CXX_FLAGS_DEBUG
            CMAKE_CXX_FLAGS_RELEASE
            CMAKE_C_FLAGS
            CMAKE_C_FLAGS_DEBUG
            CMAKE_C_FLAGS_RELEASE)

    foreach (CompilerFlag ${CompilerFlags})
        string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
    endforeach ()
endif ()
option(BUILDING_TESTING "Builds tests" ON)
add_subdirectory(src)
include_directories(src)
add_executable(testProtobufc main.c)

target_link_libraries(testProtobufc GeeJoan_C)

if (BUILDING_TESTING)
    MESSAGE(STATUS "BUILD TEST")
    add_subdirectory(tests)
endif ()
